// utools preload的一些使用
utools.showNotification('Hi, ViTools !!!!');
const { readFileSync } = require('fs');
const os = require('os');

window.isUTools = true;

const readFile = function (filePath = __dirname + '/plugin.json') {
  const data = readFileSync(filePath, 'utf8');
  return data;
};
// index.html中使用 `console.log(window.readConfig())`

function getHomedir() {
  const osInfo = {};
  ['tmpdir', 'homedir', 'hostname', 'platform'].forEach((key) => {
    osInfo[key] = os[key]();
  });
  return osInfo;
}

window.utoolsPreload = {
  readFile,
  getHomedir,
};

window.exports = {
  test: {
    mode: 'none',
    args: {
      enter: (action) => {
        // window.utools.hideMainWindow()
        // window.utools.outPlugin()
      },
    },
  },
};
